{% extends "zato/index.html" %}
{% load extras %}
{% block html_title %}Custom statistics{% endblock %}

{% block "extra_css" %}
    <link rel="stylesheet" media="screen" href="/static/css/stats-user.css" />
{% endblock %}

{% block "extra_js" %}
    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/js/common.js"></script>
    <script nonce="{{ CSP_NONCE }}">
        $.fn.zato.data_table.get_columns = function() {
            return [
                '_numbering',
                '_selection',

                'name',
                'description',
            ]
        }
    </script>
{% endblock %}

{% block "content" %}
<h2 class="zato">Custom statistics</h2>

{% if not zato_clusters %} {% include "zato/no-clusters.html" %} {% else %}

<div id="user-message-div" style='display:none'><pre id="user-message" class="user-message"></pre></div>

{% if cluster_id %}

<div id="markup">
    <div style="text-align: center !important;">
    <br/>

    {% if items %}

    <table id="data-table" style="width:50%; margin: auto">
        <thead>
            <tr class='ignore'>
                <th>&nbsp;</th>
                <th>&nbsp;</th>

                <th style="text-align: left;"><a href="#">Name</a></th>
                <th style="text-align: left;"><a href="#">Details</a></th>
        </thead>

        <tbody>
            {% for item in items.items %}
            <tr class="{% cycle 'odd' 'even' %}" id='tr_{{ item.id }}'>
                <td class='numbering' style="width:10px">&nbsp;</td>
                <td class="impexp"><input type="checkbox" /></td>

                <td style="text-align: left;"><a class="stats" href="?cluster_id={{ cluster_id }}&amp;action=BrowseStats&amp;{{ item.id_name }}={{ item.id }}">{{ item.name }}</a></td>
                <td style="text-align: left;">
                    <span class="description">
                        {{ item.description }}
                    </span>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    {% else %}

    No custom statistics found.
    <a href="#">Click here</a>
    to learn how to
    create your own
    statistics dashboard
    in Zato.

    {% endif %}

    </div>
</div>

{% endif %} {% comment %}cluster_id{% endcomment %}

{% endif %}{% comment %}not zato_clusters{% endcomment %} {% endblock %}
